DECLARE @startDateString DATETIME
DECLARE @endDateString DATETIME
SET @startDateString = '2009-01-1 00:00:00.000'
SET @endDateString = '2009-12-31 23:59:59.999'

SELECT County.Name , COUNT(dbo.Person.County_id) AS [Count] FROM county, person, stay WHERE dbo.Person.County_id = dbo.County.id AND dbo.Person.id = stay.patient_id AND stay.checkinDate > @startDateString AND stay.checkoutDate < '2009-12-31 23:59:59.999' GROUP BY County.Name